//this class use poco library thread to implement threadimpl interface
//andycai_sc 2011-04-29

#ifndef POCOTHREADIMPL_H
#define POCOTHREADIMPL_H

#include "Poco/Foundation.h"
#include "Poco/Thread.h"
#include "Poco/Runnable.h"
#include "GParallel/GThreadImpl.h"

class PocoThreadImpl;
class RunnableImpl : public Poco::Runnable
{
	friend class PocoThreadImpl;
public:
	void run();

private:
	RunnableImpl(PocoThreadImpl* pocoThreadImpl);
	virtual ~RunnableImpl();
	PocoThreadImpl* m_pocoThreadImpl;
};

class PocoThreadImpl : public GThreadImpl
{
public:
	PocoThreadImpl(GThread* _thread);
	virtual ~PocoThreadImpl();

	void startImpl();
	void stopImpl();
	void joinImpl();

private:
	RunnableImpl m_runable;
	Poco::Thread m_pocoThread;
};


#endif
